package com.jf.cloud.user.service.impl;

import com.jf.cloud.common.database.dto.PageDTO;
import com.jf.cloud.common.database.util.PageUtil;
import com.jf.cloud.common.database.vo.PageVO;
import com.jf.cloud.user.model.UserTravels;
import com.jf.cloud.user.mapper.UserTravelsMapper;
import com.jf.cloud.user.service.UserTravelsService;
import org.springframework.stereotype.Service;

import org.springframework.beans.factory.annotation.Autowired;

/**
 * 
 *
 * @author zz
 * @date 2023-11-09 09:50:04
 */
@Service
public class UserTravelsServiceImpl implements UserTravelsService {

    @Autowired
    private UserTravelsMapper userTravelsMapper;

    @Override
    public PageVO<UserTravels> page(PageDTO pageDTO) {
        return PageUtil.doPage(pageDTO, () -> userTravelsMapper.list(null));
    }

    @Override
    public PageVO<UserTravels> list(PageDTO pageDTO,Long userId) {
        return PageUtil.doPage(pageDTO, () -> userTravelsMapper.list(userId));
    }

    @Override
    public UserTravels getById(Long id) {
        return userTravelsMapper.getById(id);
    }

    @Override
    public void save(UserTravels userTravels) {
        userTravelsMapper.save(userTravels);
    }

    @Override
    public void update(UserTravels userTravels) {
        userTravelsMapper.update(userTravels);
    }

    @Override
    public void deleteById(Long id) {
        userTravelsMapper.deleteById(id);
    }
}
